-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX Accountancy - Blocking on annual closing #30653
Conversation
@@ -2707,7 +2715,7 @@ public function closeFiscalPeriod($fiscal_period_id, $new_fiscal_period_id, $sep | |||
$sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')'; | |||
$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'"; | |||
$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'"; | |||
$sql .= ' GROUP BY t.numero_compte, t.label_compte, aa.pcg_type'; | |||
$sql .= ' GROUP BY t.numero_compte, aa.pcg_type'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imagine you have in database
1 line: account = 12345, label = 'A label for the transaction", amount 10
1 line: account = 12345, label = 'A different transaction', amount 15
What do we want after creating the "A nouveau" lines ?
Just 1 line with amount 25 and label = 'A nouveau for closure abc' ?
Can you confirm ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that this is exactly what we're aiming for. It's the a-nouveaux principle.
The a-nouveaux entry is similar to a trial balance in reality.
In France, this consists of summarizing all class 1 to 5 accounts (CAPIT to FINAN) in a single account.
And the annual result class 7 - 6 (INCOME - EXPENSE) goes to account 120 or 129.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So PR seems good to me.
Hi, any news on this merge request? I've not checked whether it's fixed in 19.0.3 or 20.x though but I'm a bit stuck for the annual closure. It there any workaround for the mean time? I can test the closing with patches from this MR since I reproduce 100% the issue. |
I did some investigation around the issue, this triggers the BookkeepingRecordAlreadyExists error with the details on auxiliary accounts enabled. After some additional logs, I get :
But when I check for any bookkeeping entries in llx_accounting_bookkeeping with either doc_type=closure or label_operation like Exercice%, I don't get any entries, so I suppose it comes from entries being added multiple tests So I guessed what is happening is that it might create multiple entries with the same label and numero_compte , which is indeed the case:
Is grouping those "A-nouveau" or finding a way to create them uniquely in an identifiable manner the root cause of the issue? |
Ok I did some investigation without the auxiliary account details yesterday evening and I understand better where the MR is going. Without the option enabled, I had those errors:
A previous bookkeeping operation got an incorrect I also had another instance of the issue where some operations were labelled as "BANQUE XXX", and others with the same account labelled "BANQUE YYY". The original was that the "BANQUE XXX" was bought by "BANQUE YYY" and changed name, so the bank name was refleted back by modifying the bank record on the bank management page. But then. In both those case, because the label was different, the grouping created two entries, so changing the grouping to not account for label_compte seems like a good solution here:
Likewise, doing a fallback to the current value of the account seems like the correct solution if the original code doesn't supply a specific operation name (that might be changed depending on the configuration of the account), instead of using the one from the original bookkeeping posting (that cannot be updated)
I've not checked if the MR would fix the issue on my case, but I'd say it would given the analysis. I will test that during the week. In the mean time, I think I can also write a test mapping the problem I encountered for non-regression testing if it can be integrated to the MR or after the MR. |
Hi @alexandre-janniaux and @aspangaro and @eldy
I already wrote a code to fix all of them but I need advises/guidelines from our experts here on:
Here are the issues and results in the SQL request moving from 2132 rows to 325: |
Hi, sorry for the answer delay. I'm not sure I'll be able to answer everything but, first, disclamer:
I guess what we really want is the current value in the configuration (the only source where we don't have a possible confusion since they are unique). In short, the bookkeeping entries were generated with labels coming from the AccountingAccount. They cannot be updated, but the new entries cannot have both values anyway so using the alledgedly corrected one is probably better. Ideally, we would not have different label in the data model but on the technical side, it implies being able to modify previous bookkeeping records.
No clue on my side, but having the empty bookeeping can serve as proof of processing (to check later that every account have been transfered) and reference (origin point, if we want to compare exercices). Maybe this still has a usage? |
I will submit another PR to accelerate the fix whatever solution will be chosen. |
Thanks a lot for the efforts, that's really appreciated. 🙏 |
Fix related to this forum post : https://www.dolibarr.fr/forum/t/cloture-exercice-et-a-nouveau/47070
If an account is used with an other label, the closure is impossible.
Need feedback